Repository navigation
fix(web): browser test mocks no longer hang the suite - #155
Merged
Merged
Conversation
Two browser tests never finished loading, and vitest reports that only as a generic "error when mocking a module" once the run ends. ThreadRelationshipsControl replaced the environments module with two exports, so useEnvironments, which useSettings imports through threads.ts, was missing and the browser rejected the module. The mock now keeps the real module and overrides only the two hooks the test drives. ChatMarkdown's command mock awaited threads.ts from inside the factory that mocks use-atom-command, which useSettings imports while threads.ts is still evaluating, so the factory never resolved and the file collected no tests. The factory now reads threadEnvironment from a module-scope import. Model: grok-4.7 Task: fix the browser test project vi.mock loader failure Agent: magpie Lane: magpie Harness: t3/claude-code Model-family: Grok Model-generation: 4.7 Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The full web browser test project ended every run with one unhandled rejection,
[vitest] There was an error when mocking a module, and two files that never collected a test. The mocker wraps the real cause in that message, so the failure looked like one shared loader bug.Two test files were each stuck loading for a different reason:
ThreadRelationshipsControl.browser.test.tsxreplaced theenvironmentsmodule with a factory returning only the two hooks the test drives. The component reachesuseSettingsthroughthreads.ts, anduseSettingsvalue-importsuseEnvironments, so the browser rejected the module for the missing export. The mock now keeps the real module and overrides only those two hooks.ChatMarkdown.permissions.browser.test.tsxawaitedthreads.tsfrom inside the factory that mocksuse-atom-command.threads.tsreachesuseSettings, which importsuse-atom-command, so the factory waited on a module that was waiting on the factory and never resolved. The factory now readsthreadEnvironmentfrom a module-scope import.After the fix the browser project loads all 241 files and the unhandled rejection is gone. Both changed files pass on their own (13 and 8 tests), and
vp run typecheckinapps/webexits 0. A full run on a heavily loaded machine still reports 18 failures in four files this change does not touch (Sidebar,useInlineActionConfirm,CloudVoiceConfiguration,word-document), all timeouts or assertion failures rather than loader errors.Deploy: none
Model: grok-4.7
Task: fix the browser test project vi.mock loader failure
Agent: magpie
🤖 Generated with Claude Code